#CXX = g++
#CXX = clang++

EXE=OpenWindow
LIGHTYSRC=../../src
SOURCES=main.cpp
OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES))))
UNAME_S:=$(shell uname -s)

CXXFLAGS=-I$(LIGHTYSRC)/
CXXFLAGS+=-std=c++17 -Wall -Wextra -O2
LIBS=`pkg-config --libs --cflags glew sdl2 SDL2_mixer SDL2_ttf SDL2_image jsoncpp`


ifeq ($(UNAME_S), Darwin) #APPLE
	ECHO_MESSAGE="Mac OS X"
	LIBS+=-lGLEW -framework GLUT -framework OpenGL -framework Cocoa
endif

ifeq ($(OS), Windows_NT)
	ECHO_MESSAGE="MinGW"
	LIBS+=-lopengl32
endif


%.o:%.cpp
	$(CXX) $(CXXFLAGS) $(LIBS) -c -o $@ $<

$(EXE): $(OBJS)
	$(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS)

clean:
	rm -rf $(EXE) $(OBJS)

